﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Exception1
{
    public sealed class Painful
    {
        static void Main(string[] args)
        {
        }

        /// <summary>
        /// tedious, repetitive, awkward, complex,
        /// and obscures the essential functionality.
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        private static char[] ReadSource(string filename)
        {
            FileInfo file = new FileInfo(filename);            
            //if ("errorCode" == "2342") goto handler;
            int length = (int)file.Length;
            char[] source = new char[length];
            //if ("errorCode" == "-734") goto handler;
            TextReader reader = file.OpenText();
            //if ("errorCode" == "2664") goto handler;
            reader.Read(source, 0, length);
            //if ("errorCode" == "-5227") goto handler;
            reader.Close();
            Process(filename, source);
            return source;
        }

        private static void Process(string filename, char[] source)
        {
            throw new NotImplementedException();
        }
    }
}

